<template>
	<view class="goods-list">
		<view v-for="(item, index) in ListContent" :key="index" class="goods-item" @click="navToDetailPage(item)">
			<view class="image-wrapper">
				<image :src="item.url" mode="aspectFill"></image>
			</view>
			<view class="conten-bottom">
				<text class="title clamp">{{item.productName}}</text>
				<view class="clamp-text">
					<text class="clamp-text1">{{item.clampText1}}</text>
					<text class="clamp-text2">{{item.clampText2}}</text>
				</view>
				<view class="price-box">
					<text class="price">{{item.unitPrice}}</text>
					<text class="price-unit"><text class="unit">￥</text>{{item.soldUnit}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import json from '@/json/brand.js'
	export default {
		props: {
			ListContent:{
				type:Array,
				default:function(){
					return []
				}
			}
		},
		data() {
			return {

			}
		},
		methods:{
			navToDetailPage(){
				uni.navigateTo({
					url:'/pages/goods/detail/detail'
				})
			}
		}
	}
</script>

<style lang="scss">
	/* 商品列表 */
	.goods-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0 20rpx;
		margin-top: 16rpx;

		.goods-item {
			background: #fff;
			display: flex;
			flex-direction: column;
			width: 49%;
			margin-bottom: 16rpx;

			&:nth-child(2n+1) {
				margin-right: 14rpx;
			}
		}

		.image-wrapper {
			width: 100%;
			height: 330rpx;
			border-radius: 3px;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
				opacity: 1;
			}
		}

		.conten-bottom {
			padding: 24rpx 15rpx 30rpx 15rpx;

			.title {
				font-size: 30rpx;
				color: #333;
			}

			.clamp-text {
				display: flex;
				margin-top: 16rpx;

				text {
					padding: 6rpx 11rpx;
					font-size: 18rpx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 1;
				}

				.clamp-text1 {
					margin-right: 10rpx;
					border: 1rpx solid rgba(29, 184, 240, 1);
					border-radius: 7rpx;
					color: rgba(29, 198, 240, 1);
				}

				.clamp-text2 {
					border: 1rpx solid rgba(253, 116, 11, 1);
					border-radius: 7rpx;
					color: rgba(250, 143, 20, 1);
				}
			}

			.price-box {
				margin-top: 34rpx;
				display: flex;
				align-items: center;
				font-family: PingFang SC;
				font-weight: bold;
			}

			.price {
				font-size: 32rpx;
				color: #F01E32;

				&:before {
					content: '￥';
					font-size: 24rpx;
				}
			}

			.price-unit {
				margin-left: 10rpx;
				font-size: 24rpx;
				text-decoration: line-through;
				color: #A4A4A4;

				.unit {
					font-size: 20rpx;
				}
			}
		}
	}
</style>
